# -*- coding: utf-8 -*-            
# @Time : 2024/9/11 14:34
# @FileName: mongo.py
# @Target:
from pymongo import MongoClient
from gridfs import GridFS
import base64
from utils.settings import mongodb_host, mongodb_port


class Mongo_Logger(object):
    def __init__(self,
                 Mongo_URL=mongodb_host,
                 Mongo_Port=mongodb_port
                 ):
        client = MongoClient(host=Mongo_URL, port=Mongo_Port)
        db_client = client.get_database(name='log')
        self.logger_qwen2 = db_client['qwen2']
        self.logger_translator = db_client['translator']

    def insert_log_qwen2(self, dic):
        self.logger_qwen2.insert_one(dic)

    def insert_translation(self, dic):
        self.logger_translator.insert_one(dic)



logger = Mongo_Logger()

if __name__ == '__main__':
    logger.insert_log_qwen2({'aaa' : 'ccc'})


